package com.bilibili.bilibili.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * 作者：郭传沛 on 2017/3/9 16:16
 * 邮箱：bestyourselfgcp@163.com
 * 类用途:
 */

public class TabLayoutAdapter extends FragmentStatePagerAdapter {
    private List<Fragment> mFragments;
    private final List<String> mStrings;

    public TabLayoutAdapter(FragmentManager fm, List<Fragment> fragments) {
        super(fm);
        mFragments = fragments;
        mStrings = new ArrayList<>();
        mStrings.add("直播");
        mStrings.add("推荐");
        mStrings.add("番剧");
        mStrings.add("分区");
        mStrings.add("发现");
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mStrings.get(position);
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }
}
